#

| Chapter 1 Introduction |

## 1.30 Redirecting Input and Output

When you run most UNIX programs, their output goes to your terminal. If the programs prompt you for input, they read it from your terminal. You can tell the shell to redirect that output and input from places besides your terminal. For instance, you can save the output of a program in a file, or tell a program to read data from a file instead of the keyboard. The shell handles the redirection of input and output. Article 13.1 explains the syntax you use to control redirection.

A program can also take its input from the output of another program. This kind of redirection is called a pipe (1.3). Most UNIX utilities are designed to work with data coming from a pipe; a program that transforms that data in some way is called a filter.

To understand the nitty-gritty details of redirection, you need to understand open files and file descriptors. See article 45.20.

- JP, TOR

1.29 When Is a File Not a File? |  | 1.31 The X Window System